import request from '@/utils/request'

// 查询商品规格列表
export function listSpec(query) {
  return request({
    url: '/product/productSpec/list',
    method: 'get',
    params: query
  })
}

// 新增商品规格
export function addSpec(data) {
    return request({
      url: '/product/productSpec',
      method: 'post',
      data: data
    })
}

// 删除商品规格
export function deleteSpecs(ids) {
    return request({
      url: '/product/productSpec/' + ids,
      method: 'delete',
      data: ids,
      headers: {
      'Content-Type': 'application/json;charset=UTF-8'
      }
    })
}

// 修改商品规格
export function updateSpec(data) {
  return request({
    url: '/product/productSpec',
    method: 'put',
    data: data
  })
}

// 根据分类获取分类规格
export function getCategorySpecAll(categoryId) {
  return request({
    url: '/product/productSpec/productSpecList/' + categoryId,
    method: 'get'
  })
}


// 根据分类ID获取路径（[1, 2, 3]）
export function getCategoryPath(categoryId) {
  return request({
    url: '/product/category/path/' + categoryId,
    method: 'get'
  })
}